namespace CSharpDay10__Entity_Framwork_.Migrations
{
    using CSharpDay10__Entity_Framwork_.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<CSharpDay10__Entity_Framwork_.Models.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(CSharpDay10__Entity_Framwork_.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Movies.AddOrUpdate(
                    m => m.MovieId,
                    new Movie() { MovieId = 1, Title = "My First Film", TimeCreated = DateTime.Now, Rating = FilmRating.PG },
                    new Movie() { MovieId = 2, Title = "My Second Film", TimeCreated = DateTime.Now, Rating = FilmRating.PG13 },
                    new Movie() { MovieId = 3, Title = "My Third Film", TimeCreated = DateTime.Now, Rating = FilmRating.G },
                    new Movie() { MovieId = 4, Title = "My Fourth Film", TimeCreated = DateTime.Now, Rating = FilmRating.R }
                );
        }
    }
}
